<?php
$FILENAME = strtolower($_GET['RSID']);
$PRXFILE = $GLOBALS['DOC'] . '\PRFLDOCS\\' . $_GET['RSIF'] . '\\' . $FILENAME;

$n_FILENAME = substr($FILENAME, 0, 32);
$n_FILEXT = substr($FILENAME, 32, 36);

mn_field('button', 'ED', 'doc_0', 'Rosto', '', '', '', '" onclick="
			javascript:document.getElementById(\'FileView1\').src=\'_response/bin.php?img=' . $FILENAME . '&RSIF=' . $_GET['RSIF'] . '\';');

$i = 1;
for ($f = 1; $f <= $i; $f++) {
    if (file_exists($GLOBALS['DOC'] . 'PRFLDOCS\\' . $_GET['RSIF'] . '\\' . $n_FILENAME . '_' . $f . $n_FILEXT)) {
        $i++;

        mn_field('button', 'ED', 'doc_' . $f, 'Pagina ' . $f, '', '', '', '" onclick="
			javascript:document.getElementById(\'FileView1\').src=\'_response/bin.php?img=' . $n_FILENAME . '_' . $f . $n_FILEXT . '&RSIF=' . $_GET['RSIF'] . '\'');
    } else {
        $nxt_FILE = $f;
    }
}
?>

<input type="button" name="doc_pageadd" id="doc_pageadd" value="+ Nova Pagina" onClick="
    newwindow('Modules/CLDJ49SJ/up.cldoc?ID=<?php echo $_GET['ID']; ?>&CID=<?php echo $_GET['RSIF']; ?>&RNF=<?php echo $nxt_FILE; ?>','Uploader');">

<input type="button" name="doc_pagedel" id="doc_pagedel" value="Remover Pagina" onClick="
    idwindow('Remover pagina','doc_rmv','','_response/call.php?get=Operative/view/viewsenderdocumentattchmenu&ID=<?php echo $_GET['ID']; ?>&RSID=<?php echo $_GET['RSID']; ?>&RSIF=<?php echo $_GET['RSIF']; ?>',300,200);">
<iframe width="100%" height="96%" name="FileView1" id="FileView1" src="_response/bin.php?img=<?php echo strtolower($_GET['RSID']) . '&RSIF=' . $_GET['RSIF']; ?>"></iframe>